<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var ages = [32, 33, 16, 40];

        function checkAdult(age) {
            return age >= 18;
        }

        function myFunction() {
            console.log(ages.filter(checkAdult));
        }
        myFunction();
    </script>
</head>

<body>

</body>

</html>